<template class="index_background">
  <div>
    <el-collapse>
      <div class="divcss5" style="border-bottom:3px solid #eee">
        <h5 align="left">简历投递进度</h5>
      </div>
      <el-table :data="sRecord">
        <template v-for="item in tableLabel">
          <el-table-column
            :key="index"
            :prop="item.prop"
            :label="item.label"
            :width="item.width"
            :align="item.align">
          </el-table-column>
        </template>
<!--        <el-table-column prop="postId" label="编号" width="100" align="center">-->
<!--        </el-table-column>-->
<!--        <el-table-column prop="jid" label="职位名称" width="200" align="center">-->
<!--        </el-table-column>-->
<!--        <el-table-column prop="eid" label="公司名称" width="200" align="center">-->
<!--        </el-table-column>-->
<!--        <el-table-column prop="updateTime" label="投递时间" width="200" align="center">-->
<!--        </el-table-column>-->
<!--        <el-table-column prop="status" label="最新进度" width="200" align="center">-->
<!--        </el-table-column>-->
      </el-table>
    </el-collapse>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="100">
    </el-pagination>
  </div>
</template>

<style>
  .divcss5{
    margin:30px 0;
    color: rgb(144,144,144);
    height: 100px;
  }
  .index_background{
    background:white;
  }
  .lable{
    color: rgb(144,144,144);
    margin-top:30px;
    margin-bottom:30px;
  }
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }
  .el-aside {
    color: #333;
  }
</style>

<script>
  import fetch from '../api/fetch'
  export default {
    data() {
      return {
        sRecord: [],
        tableLabel:[
          {prop:"postId", label:"编号",width:"100",align:"center"},
          {prop:"jid", label:"职位名称",width:"200",align:"center"},
          {prop:"eid", label:"公司名称",width:"200",align:"center"},
          {prop:"updateTime", label:"投递时间",width:"200",align:"center"},
          {prop:"status", label:"最新进度",width:"200",align:"center"},
        ],
          page: {
            pageSize:10,
            currentPage:1,
            pageSizes:[5,10,20,30,50],
            total:0
      }
    }},
    mounted() {
      // 传入当前学生的id
      // var obj = {pageNum: 1, pageSize: 10, StuPostRecord: {sid: 111}} 
      var obj = {pageNum: 1, pageSize: 10, StuPostRecord: {sid: sessionStorage.getItem('userId')}}
      console.log(obj)
      this.getCVProgress(obj)
    },
    methods: {
      getCVProgress(obj) {
        fetch.getCVProgress(obj).then(res => {
          console.log(res.data)
          for (var i=0; i<res.data.rows.length; i++)
          {
            var sta = '';
            if (res.data.rows[i].StuPostRecord.status === 0) {
              sta = '简历已被拒绝'
            } else if (res.data.rows[i].StuPostRecord.status === 1) {
              sta = '简历被接收'
            } else if (res.data.rows[i].StuPostRecord.status === 2) {
              sta = '简历未查看'
            } else if (res.data.rows[i].StuPostRecord.status === 3) {
              sta = '被邀请面试'
            } else if (res.data.rows[i].StuPostRecord.status === 4) {
              sta = '面试中'
            } else if (res.data.rows[i].StuPostRecord.status === 5) {
              sta = '通过面试'
            }

            this.sRecord.push({
              postId: res.data.rows[i].StuPostRecord.postId,
              jid: res.data.rows[i].EntJob.name,
              eid: res.data.rows[i].EntInfo.ename,
              updateTime: res.data.rows[i].StuPostRecord.updateTime,
              status: sta
            })
          }
          // this.sRecord.postId = res.data.rows[0].StuPostRecord.postId
          // this.sRecord.jid = res.data.rows[0].EntJob.name
          // this.sRecord.eid = res.data.rows[0].EntInfo.ename
          // this.sRecord.updateTime = res.data.rows[0].StuPostRecord.updateTime

          // this.loadChangeInfo();
        })
      }
    }
  }

</script>

<!--const item = {
      num: '12',
      job: '前端工程师',
      company: '字节跳动',
      date: '2020-06-20 22:30',
      progress: '简历初审'

loadChangeInfo() {
      this.StuPostRecord.postId=this.postId;
      this.StuPostRecord.eid=this.eid;
      this.StuPostRecord.jid=this.jid;
      this.StuPostRecord.updateTime=this.updateTime;
      this.StuPostRecord.status=this.status;
    }
-->

